// DisplayText.cpp : implementation file
//

#include "stdafx.h"
#include "ImageLab.h"
#include "DisplayText.h"


// CDisplayText dialog

IMPLEMENT_DYNAMIC(CDisplayText, CDialog)

CDisplayText::CDisplayText(CWnd* pParent)
	: CDialog(CDisplayText::IDD, pParent)
{
	ASSERT(pParent!=NULL);
	m_Parent = pParent;
	m_nID = CDisplayText::IDD;
	::AfxInitRichEdit2();
}

CDisplayText::~CDisplayText()
{
}

void CDisplayText::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
}

//create the dialog
BOOL CDisplayText::Create()
{
	return  CDialog::Create(m_nID, m_Parent);
}

BEGIN_MESSAGE_MAP(CDisplayText, CDialog)
END_MESSAGE_MAP()


// CDisplayText message handlers
//set the text to the caption
void CDisplayText::OnSetCaption(CString str)
{
	//get the pointer to the richedit contral
	CRichEditCtrl* m_Text = (CRichEditCtrl*)CDisplayText::GetDlgItem(IDC_CAPTIONCONTENT);
	m_Text->SetWindowTextW(str);
	return;
}

//set the text to the reference
void CDisplayText::OnSetReference(CString str)
{
	//get the pointer to the reference
	CRichEditCtrl* m_Text = (CRichEditCtrl*)CDisplayText::GetDlgItem(IDC_REFERENCECONTENT);
	m_Text->SetWindowTextW(str);
	return;
}

//set the text to the authors
void CDisplayText::OnSetAuthors(CString str)
{
	//get the pointer to the authors
	CRichEditCtrl* m_Text = (CRichEditCtrl*)CDisplayText::GetDlgItem(IDC_AUTHORSCONTENT);
	m_Text->SetWindowTextW(str);
	return;
}

//set the text to the fulltext
void CDisplayText::OnSetFulltext(CString str)
{
	//get the pointer to the fulltext
	CRichEditCtrl* m_Text = (CRichEditCtrl*)CDisplayText::GetDlgItem(IDC_FULLTEXTCONTENT);
	m_Text->SetWindowTextW(str);
	return;
}

//initialize the text dialog
void CDisplayText::InitializeText(void)
{
	//initialize caption, reference, authors, and fulltext
	CDisplayText::OnSetCaption(CString(""));
	CDisplayText::OnSetReference(CString(""));
	CDisplayText::OnSetAuthors(CString(""));
	CDisplayText::OnSetFulltext(CString(""));
	return;
}